#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()

{

	int a = 20;

	int b = 40;

	int c = 0;



	while (c = a % b)

	{

		a = b;

		b = c;

	}



	printf("%d\n", b);

	return 0;

}